  import java.util.ArrayList;
import java.util.List;

import com.greatwideweb.notes.EverNoteProxy;
import com.greatwideweb.notes.NoteVO;
import com.greatwideweb.notes.NotebookService;
import com.greatwideweb.notes.NotebookVO;
import com.greatwideweb.notes.TagNotesService;
import com.greatwideweb.notes.TagService;
import com.greatwideweb.notes.TagVO;

/**
 * 
 */

/**
 * @author dave
 *
 */
public class EverNoteProxyTest
{

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception
  {
    proofOfConcept();
  }
  
  private static void proofOfConcept() throws Exception
  {
    
    NotebookService svcNb = new NotebookService();
    int SELECTED_TAG = 5;
    List<NotebookVO> books = svcNb.getNotebooks();
    NotebookVO defaultNoteBook=null;
    String selectedTagUid=null;
    if(books != null)
    {
      for(NotebookVO t : books)
      {
        System.out.println(t);
        if(t.isDefault)
        {
          defaultNoteBook = t;
        }
      }
      
      if(defaultNoteBook != null)
      {
        System.out.println("****** default note book **********");
        System.out.println(defaultNoteBook);
        System.out.println("****** default note book TAGS **********");
        TagService svcTag = new TagService();
        ArrayList<TagVO> tags = svcTag.getTags(defaultNoteBook.guid);
        if(tags == null)
          System.out.println("tags is null");
        else
        {
          int i=0;
          for(TagVO t : tags)
          {
            //System.out.println(t);
            if(i == SELECTED_TAG)
            {
              System.out.println("**************** Selected tag: " + t + " **********************");
              selectedTagUid = t.guid;
            }
            i++;
          }
        }
      }
        
    }else
    {
      System.out.println("It is null");
    }
    
    if(selectedTagUid != null)
    {
      System.out.println("Get Notes from Selected Tag");
      TagNotesService svcTagNotes = new TagNotesService();
      ArrayList<NoteVO> notes = svcTagNotes.getNotes(selectedTagUid);
      if(notes == null)
        System.out.println("null notes");
      else 
      {
        for(NoteVO vo : notes)
        {
         // System.out.println(vo.tags);
          ;
        }
      }
        
      
    }else
      System.out.println("Selected tag is null");
    
  }

}
